package net.socket;

import java.io.InputStream;
import java.net.Socket;

public class DaytimeClient
{
	public static void main(String[] args)
	{
		String hostname;
		hostname = "time.nist.gov";
		try
		{
			Socket theSocket = new Socket(hostname, 13);
			InputStream timeStream = theSocket.getInputStream();
			StringBuffer time = new StringBuffer();
			int c;
			while((c=timeStream.read())!=-1)
			{
				time.append((char)c);
			}
			System.out.println(time.toString());
		}
		catch (Exception e)
		{
		}
	}
}
